home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 October / Macformat17.cdr / Shareware City / Developers / GAL ƒ / GAL examples / numeric input < prev    next >
Encoding:
Text File  |  1994-07-11  |  527 b   |  30 lines  |  [TEXT/ttxt]

  1. ; input number and leave in reg 3
  2.  
  3.     copy:word    0=>reg3
  4. getloop
  5.     jump:sub    input
  6.     compare:char    '0'=>reg0
  7.     jump:greater_eq    gottall
  8.     compare:char        '9'=>reg0
  9.     jump:less_eq    gottall
  10.     multiply:word    10=>reg3
  11.     subtract:word '0'=>reg0
  12.     add:word    reg0=>reg3
  13.     jump    getloop
  14. gottall
  15.     halt
  16. input
  17.     copy:byte    instatus,Reg0
  18.     jump:equal input
  19.     copy:byte     indata=>reg0
  20.     return
  21. output
  22.     copy:long    reg0,savedata
  23.     copy:byte     outstatus=>reg0
  24.     jump:not_equal output
  25.     copy:long    savedata,Reg0
  26.     copy:byte     reg0,outdata
  27.     return
  28. savedata    variable:long    1
  29.     end    
  30.